Skip to content

Add setting always_enable_metadata_output_groups #3524

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

refi64
Copy link

@refi64 refi64 commented Jul 24, 2025

Right now, only library targets provide metadata-related output groups. This makes sense for compilation purposes, but building the metadata is also useful for other things; namely, building only the metadata is the fastest way to get diagnostic information for your workspace like cargo check does.

This PR adds a new setting, always_enable_metadata_output_groups, that enables both the build_metadata and rustc_rmeta_output output groups for non-library targets (such as binaries and tests). That means that the presence of metadata in CrateInfo can no longer be used to determine pipelind compilation support, so a new attribute, metadata_supports_pipelining, is added for that purpose.

As an example of the performance increase, compare a bazel build on a binary w/o --output_groups=rustc_rmeta_output:

INFO: Elapsed time: 2.247s, Critical Path: 2.11s

to with it:

INFO: Elapsed time: 1.034s, Critical Path: 0.90s

@refi64 refi64 force-pushed the always_enable_metadata_output_groups branch from aaf599b to 18fbe17 Compare July 24, 2025 01:35
Right now, only library targets provide metadata-related output groups.
This makes sense for compilation purposes, but building the metadata is
also useful for other things; namely, building *only* the metadata is
the fastest way to get diagnostic information for your workspace like
`cargo check` does.

This PR adds a new setting, `always_enable_metadata_output_groups`, that
enables both the `build_metadata` and `rustc_rmeta_output` output groups
for non-library targets (such as binaries and tests). That means that
the presence of metadata in `CrateInfo` can no longer be used to
determine pipelind compilation support, so a new attribute,
`metadata_supports_pipelining`, is added for that purpose.

As an example of the performance increase, compare a `bazel build` on
a binary w/o `--output_groups=rustc_rmeta_output`:

```
INFO: Elapsed time: 2.247s, Critical Path: 2.11s
```

to with it:

```
INFO: Elapsed time: 1.034s, Critical Path: 0.90s
```
@refi64 refi64 force-pushed the always_enable_metadata_output_groups branch from 18fbe17 to 2e2cd64 Compare July 24, 2025 01:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant